const Generator = require('yeoman-generator')

module.exports = class extends Generator {
    promptiing() {
        return this.prompt([
            {
                type: 'input',
                name: 'name',  // 存储的属性
                message: 'project name',
                default: this.appname

            },
            {
                type: 'input',
                name: 'desc',  // 存储的属性
                message: 'description',
                default: this.description

            }
        ])
            .then(answer => {
                this.answer = answer
            })
    }
    writing() {
        const templates = ['index.html', 'main.js', 'style.css']

        const content =
            templates.forEach(item => {
                console.log(item);
                this.fs.copyTpl(
                    this.templatePath(item),
                    // 输出文件的路径
                    this.destinationPath(item),
                    this.answer
                )
            })
    }
}